let arr=[3,15,8,29,102,22]
console.log(arr.sort((a,b)=>a-b))//由小到大[ 3, 8, 15, 22, 29, 102 ]
console.log(arr.sort((a,b)=>b-a))//由大到小[ 102, 29, 22, 15, 8, 3 ]